package com.mb.note.service.impl;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mb.note.domain.po.Category;
import com.mb.note.mapper.CategoryMapper;
import com.mb.note.service.CategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 商品表 服务实现类
 * </p>
 *
 * @author 虎哥
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public List<JSONObject> getCategoryTwo(String fid) {
        List<String> categoryTwo = categoryMapper.getCategoryTwo(fid);
        List<JSONObject> list = new ArrayList<>();
        for (String name : categoryTwo){
            JSONObject jsonObject1 = new JSONObject();
            jsonObject1.put("name",name);
            list.add(jsonObject1);
        }
        return list ;
    }
}
